/**
 * Author(s): xuming.Wong <xuming.Wong@gmail.com>
 */

#include "LightComponent.h"
#include "GameObject.h"

namespace PQEngine
{

	LightComponent::LightComponent(Ogre::Light* light)
		: Component(OBJECT_TYPE_COMPONENT_LIGHT),_light(light)
	{
		
		assert(_light);

		_lightType=_light->getType();
		_diffuseColor=Ogre::ColourValue();
		_specularColor=Ogre::ColourValue();
		_intensity=1.0f;

		_light->setType(_lightType);
		_light->setDiffuseColour(_diffuseColor);
		_light->setSpecularColour(_specularColor);
	}

	void LightComponent::update(float deltaT)
	{
		
	}

	void LightComponent::setType(LightType type)
	{
		_lightType=(Ogre::Light::LightTypes)type;
		_light->setType(_lightType);
	}

	void LightComponent::setDirection(const Ogre::Vector3& direction)
	{
		_direction=direction;
		_light->setDirection(direction);
	}

	void LightComponent::setDiffuseColor(const Ogre::ColourValue &color)
	{

		_light->setDiffuseColour(color);
	}

	void LightComponent::setSpecularColor(const Ogre::ColourValue &color)
	{
		_light->setSpecularColour(color);
	}

}
